<%@ include file="common.jspf"%>
<script type="text/javascript">
	function move(url) {
		location.href = '${pageContext.request.contextPath}' + url;
	}
	
	function del() {
		if (confirm('Are you sure?'))
			move('/note/delete/${note.noteNO}');
	}
</script>

<script type="text/javascript">
	if ('${note.noteNO}' == '0') {
		alert('It doesn\'t exist');
		history.go(-1);
	}
</script>

<article class="content">
<form:form modelAttribute="note">
	<fieldset>
		<legend>${note.noteNO}</legend>
		<p>
			<span>
				<form:select path="category.categoryNO" readOnly="yes">
					<form:options items="${categoryList}" itemValue="categoryNO" itemLabel="name"/>
				</form:select>
				<form:errors path="category.categoryNO" />
			</span>			
			<span>
				<form:input path="subject" readOnly="yes" />
				<form:errors path="subject" />
			</span>
		</p>
		<p>
			<form:label path="content">Content</form:label>
			<form:textarea path="content" readOnly="yes" rows="20" cssStyle="width:98%;" />
			<form:errors path="content" />
		</p>			
	</fieldset>
</form:form>

<!-- Button -------------------->
<div id="button" style="overflow: auto;">
	<div style="float: left;">
		<button type="button" onclick="move('/note/list');"><fmt:message key="list"/></button>
		<button type="button" onclick="move('/note/read/before/${note.noteNO}');"><fmt:message key="up"/></button>
		<button type="button" onclick="move('/note/read/after/${note.noteNO}');"><fmt:message key="down"/></button>
	</div>
	<div style="float: right;">
		<button type="button" onclick="move('/note/create');"><fmt:message key="create"/></button>
		<button type="button" onclick="move('/note/modify/${note.noteNO}');"><fmt:message key="modify"/></button>
		<button type="button" onclick="del();"><fmt:message key="delete"/></button>
	</div>
</div>
<!-------------------- Button -->
</article>